package gui.archerDbEditor;

import gui.InformationDisplay;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;

import javax.swing.BorderFactory;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import table.models.ParticipantsTableModel;
import table.models.ParticipantsTableModelRenderer;
import core.CustomIcons;
import core.GuiComponentLabels;
import dataBase.DbHolder;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class ArcherDbEditor extends javax.swing.JFrame {

	private JButton deleteEntryButton;
	private JButton addArcherButton;
	private JButton saveButton;
	private JButton closeButton;

	/** table scroll pane */
	private JScrollPane jScrollPane1;

	/** table */
	private JTable dbView;

	/** dropdown menus */
	private JComboBox countryDropDown;
	private JComboBox bowCathegoryDropDown;
	private JComboBox ageClassDropDown;
	private JComboBox nationDropDown;
	private JComboBox clubDropDown;
	private JComboBox genderDropDown;

	/** text fields */
	private JTextField birthdateTextBox;
	private JTextField nameTextBox;
	private JTextField surNameTextBox;

	/** labels */
	private JLabel ageLabel;
	private JLabel bowCathegoryLabel;
	private JLabel countryRatingLabel;
	private JLabel nameLabel;
	private JLabel surNameLabel;
	private JLabel nationLabel;
	private JLabel clubLabel;
	private JLabel genderLabel;
	private JLabel licenseLabel;
	private JLabel countryLabel;
	private JLabel ageClassLabel;
	private JLabel birthDateLabel;
	private JLabel computedAgeLabel;
	private JLabel informationLabel;

	private JPanel optionsWrapper;
	private JPanel wrapperPanel;

	/** checkboxes */
	private JCheckBox licenseCheckBox;
	private JCheckBox countryRatingCheckBox;

	/** static object for singleton pattern */
	private static ArcherDbEditor instance = null;

	/** controller for gui interaction */
	public ArcherDbEditorController controller;

	/** action listeners */
	private final ArcherDbEditorActionListener actionListener;
	private final ArcherDbEditorMouseListener mouseListener;
	private final ArcherDbEditorKeyListener keyListener;

	private ArcherDbEditor() {
		this.setIconImage(CustomIcons.iconImage);
		this.initGUI();
		this.controller = new ArcherDbEditorController();
		this.actionListener = new ArcherDbEditorActionListener(this);
		this.mouseListener = new ArcherDbEditorMouseListener(this);
		this.keyListener = new ArcherDbEditorKeyListener(this);

		this.dbView.addMouseListener(this.mouseListener);
		this.dbView.addKeyListener(this.keyListener);
		this.birthdateTextBox.addKeyListener(this.keyListener);
		this.saveButton.addActionListener(this.actionListener);
		this.closeButton.addActionListener(this.actionListener);
	}

	public static ArcherDbEditor getInstance() {
		if (instance == null) {
			instance = new ArcherDbEditor();
		}
		return instance;
	}

	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout(this.getContentPane());
			this.getContentPane().setLayout(thisLayout);
			{
				this.jScrollPane1 = new JScrollPane();
				{
					this.dbView = new JTable();
					this.jScrollPane1.setViewportView(this.dbView);
					this.dbView.setAutoCreateRowSorter(true);
					this.dbView.setDefaultRenderer(Object.class, new ParticipantsTableModelRenderer());
					this.dbView.setDefaultRenderer(Integer.class, new ParticipantsTableModelRenderer());
					this.dbView.setDefaultRenderer(Boolean.class, new ParticipantsTableModelRenderer());
				}
			}
			{
				this.wrapperPanel = new JPanel();
				GroupLayout wrapperPanelLayout = new GroupLayout(this.wrapperPanel);
				this.wrapperPanel.setLayout(wrapperPanelLayout);
				this.wrapperPanel.setBorder(BorderFactory.createTitledBorder("Bogenschützen Daten"));
				{
					this.nameLabel = new JLabel();
					this.nameLabel.setText(GuiComponentLabels.NAME);
					this.nameLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.nameLabel.setSize(84, 22);
				}
				{
					this.nationLabel = new JLabel();
					this.nationLabel.setText(GuiComponentLabels.NATION);
					this.nationLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.nationLabel.setForeground(new java.awt.Color(0, 0, 0));
					this.nationLabel.setSize(84, 22);
				}
				{
					this.bowCathegoryLabel = new JLabel();
					this.bowCathegoryLabel.setText(GuiComponentLabels.BOW_CATHEGORY);
					this.bowCathegoryLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.bowCathegoryLabel.setSize(84, 22);
				}
				{
					this.clubLabel = new JLabel();
					this.clubLabel.setText(GuiComponentLabels.CLUB);
					this.clubLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.clubLabel.setSize(84, 22);
				}
				{
					this.genderLabel = new JLabel();
					this.genderLabel.setText(GuiComponentLabels.GENDER);
					this.genderLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.genderLabel.setSize(84, 22);
				}
				{
					this.nameTextBox = new JTextField();
				}
				{
					this.nationDropDown = new JComboBox();
					this.nationDropDown.setEditable(true);
				}
				{
					this.countryDropDown = new JComboBox();
					this.countryDropDown.setEditable(true);
				}
				{
					this.bowCathegoryDropDown = new JComboBox();
					this.bowCathegoryDropDown.setEditable(true);
				}
				{
					this.ageClassDropDown = new JComboBox();
					this.ageClassDropDown.setEditable(true);
				}
				{
					this.clubDropDown = new JComboBox();
					this.clubDropDown.setEditable(true);
				}
				{
					this.genderDropDown = new JComboBox();
					this.genderDropDown.setEditable(false);
				}
				{
					this.licenseLabel = new JLabel();
					this.licenseLabel.setText(GuiComponentLabels.LICENSE);
					this.licenseLabel.setBackground(new java.awt.Color(212, 208, 200));
				}
				{
					this.computedAgeLabel = new JLabel();
					this.computedAgeLabel.setText("-");
				}
				{
					this.licenseCheckBox = new JCheckBox();
				}
				{
					this.surNameLabel = new JLabel();
					this.surNameLabel.setText(GuiComponentLabels.SURNAME);
					this.surNameLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.surNameLabel.setSize(84, 22);
				}
				{
					this.countryLabel = new JLabel();
					this.countryLabel.setText(GuiComponentLabels.COUNTRY);
					this.countryLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.countryLabel.setSize(84, 22);
				}
				{
					this.ageClassLabel = new JLabel();
					this.ageClassLabel.setText(GuiComponentLabels.AGE_CLASS);
					this.ageClassLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.ageClassLabel.setSize(84, 22);
				}
				{
					this.birthDateLabel = new JLabel();
					this.birthDateLabel.setText(GuiComponentLabels.BIRTHDATE);
					this.birthDateLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.birthDateLabel.setSize(84, 22);
				}
				{
					this.ageLabel = new JLabel();
					this.ageLabel.setText(GuiComponentLabels.AGE);
					this.ageLabel.setBackground(new java.awt.Color(212, 208, 200));
					this.ageLabel.setSize(84, 22);
				}
				{
					this.surNameTextBox = new JTextField();
				}
				{
					this.birthdateTextBox = new JTextField();
				}
				{
					this.countryRatingLabel = new JLabel();
					this.countryRatingLabel.setText(GuiComponentLabels.COUNTRY_RATING);
					this.countryRatingLabel.setBackground(new java.awt.Color(212, 208, 200));
				}
				{
					this.countryRatingCheckBox = new JCheckBox();
				}
				wrapperPanelLayout.setHorizontalGroup(wrapperPanelLayout
						.createSequentialGroup()
						.addContainerGap()
						.addGroup(
								wrapperPanelLayout.createParallelGroup().addComponent(this.nationLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.bowCathegoryLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.clubLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.genderLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.licenseLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.nameLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 147, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
						.addGroup(
								wrapperPanelLayout
										.createParallelGroup()
										.addComponent(this.licenseCheckBox, GroupLayout.Alignment.LEADING, 0, 202, Short.MAX_VALUE)
										.addGroup(
												wrapperPanelLayout.createSequentialGroup().addComponent(this.nameTextBox, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
														.addGap(0, 0, Short.MAX_VALUE))
										.addGroup(
												wrapperPanelLayout.createSequentialGroup().addComponent(this.nationDropDown, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
														.addGap(0, 0, Short.MAX_VALUE))
										.addGroup(
												wrapperPanelLayout.createSequentialGroup().addComponent(this.bowCathegoryDropDown, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
														.addGap(0, 0, Short.MAX_VALUE))
										.addGroup(
												wrapperPanelLayout.createSequentialGroup().addComponent(this.clubDropDown, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
														.addGap(0, 0, Short.MAX_VALUE))
										.addGroup(
												wrapperPanelLayout.createSequentialGroup().addComponent(this.genderDropDown, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
														.addGap(0, 0, Short.MAX_VALUE)))
						.addGap(40)
						.addGroup(
								wrapperPanelLayout.createParallelGroup().addComponent(this.ageLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.surNameLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.countryLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.ageClassLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.birthDateLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.countryRatingLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
						.addGroup(
								wrapperPanelLayout.createParallelGroup().addComponent(this.surNameTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.countryDropDown, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.ageClassDropDown, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.birthdateTextBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.countryRatingCheckBox, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.computedAgeLabel, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE)).addContainerGap());
				wrapperPanelLayout.setVerticalGroup(wrapperPanelLayout
						.createSequentialGroup()
						.addGroup(
								wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.surNameLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.surNameTextBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.nameTextBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.nameLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.countryLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.countryDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.nationDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.nationLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.ageClassLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.ageClassDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.bowCathegoryDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.bowCathegoryLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.birthDateLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.birthdateTextBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.clubDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.clubLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.ageLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.computedAgeLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.genderDropDown, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.genderLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
						.addGroup(
								wrapperPanelLayout
										.createParallelGroup()
										.addGroup(
												GroupLayout.Alignment.LEADING,
												wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
														.addComponent(this.countryRatingCheckBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
														.addComponent(this.licenseCheckBox, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE))
										.addGroup(
												GroupLayout.Alignment.LEADING,
												wrapperPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
														.addComponent(this.countryRatingLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
														.addComponent(this.licenseLabel, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)))
						.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED));
			}
			{
				this.optionsWrapper = new JPanel();
				GroupLayout optionsWrapperLayout = new GroupLayout(this.optionsWrapper);
				this.optionsWrapper.setLayout(optionsWrapperLayout);
				this.optionsWrapper.setBorder(BorderFactory.createTitledBorder("Optionen"));
				{
					this.saveButton = new JButton();
					this.saveButton.setText(GuiComponentLabels.SAVE_BUTTON);
					this.saveButton.setIcon(CustomIcons.save);
				}
				{
					this.closeButton = new JButton();
					this.closeButton.setText(GuiComponentLabels.CLOSE_BUTTON);
					this.closeButton.setIcon(CustomIcons.exit);
				}
				{
					this.addArcherButton = new JButton();
					this.addArcherButton.setText(GuiComponentLabels.ADD_PLAYER_BUTTON);
					this.addArcherButton.setIcon(CustomIcons.add);
				}
				{
					this.deleteEntryButton = new JButton();
					this.deleteEntryButton.setText(GuiComponentLabels.DELETE_PLAYER_BUTTON);
					this.deleteEntryButton.setIcon(CustomIcons.delete);

					this.deleteEntryButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							// TODO
							int selectedTableRow = ArcherDbEditor.this.dbView.getSelectedRow();
							int modelRow = ArcherDbEditor.this.dbView.convertRowIndexToModel(ArcherDbEditor.this.dbView.getSelectedRow());

							int playerID = Integer.parseInt(ArcherDbEditor.this.dbView.getModel().getValueAt(modelRow, 0).toString());

							try {

								DbHolder.getInstance().getArcherData().deletePerson(playerID);

								/* to avoid nullpointerException */
								if (ArcherDbEditor.this.dbView.getRowCount() > 1) {
									((ParticipantsTableModel) ArcherDbEditor.this.dbView.getModel()).removeRow(modelRow);
									try {
										ArcherDbEditor.this.dbView.setRowSelectionInterval(selectedTableRow, selectedTableRow);
									} catch (IllegalArgumentException e) {
										ArcherDbEditor.this.dbView.setRowSelectionInterval(selectedTableRow - 1, selectedTableRow - 1);
									}
								} else {
									ArcherDbEditor.this.controller.buildTable();
								}
								InformationDisplay deleteInformation = new InformationDisplay(ArcherDbEditor.this.informationLabel, "Eintrag gelöscht", Color.red, 2000);
								deleteInformation.start();
							} catch (SQLException e) {
								e.printStackTrace();
							}
						}
					});
				}
				optionsWrapperLayout.setHorizontalGroup(optionsWrapperLayout
						.createSequentialGroup()
						.addContainerGap()
						.addGroup(
								optionsWrapperLayout
										.createParallelGroup()
										.addGroup(
												GroupLayout.Alignment.LEADING,
												optionsWrapperLayout.createSequentialGroup().addComponent(this.saveButton, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE)
														.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
														.addComponent(this.closeButton, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE))
										.addComponent(this.deleteEntryButton, GroupLayout.Alignment.LEADING, 0, 261, Short.MAX_VALUE)
										.addComponent(this.addArcherButton, GroupLayout.Alignment.LEADING, 0, 261, Short.MAX_VALUE)
										.addGroup(
												GroupLayout.Alignment.LEADING,
												optionsWrapperLayout.createSequentialGroup().addComponent(this.getInformationLabel(), 0, 257, Short.MAX_VALUE)
														.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE))).addContainerGap());
				optionsWrapperLayout.setVerticalGroup(optionsWrapperLayout
						.createSequentialGroup()
						.addComponent(this.getInformationLabel(), GroupLayout.PREFERRED_SIZE, 15, GroupLayout.PREFERRED_SIZE)
						.addGap(52)
						.addComponent(this.deleteEntryButton, GroupLayout.PREFERRED_SIZE, 23, GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
						.addComponent(this.addArcherButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
						.addGroup(
								optionsWrapperLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
										.addComponent(this.closeButton, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
										.addComponent(this.saveButton, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
						.addContainerGap());
			}
			thisLayout.setVerticalGroup(thisLayout
					.createSequentialGroup()
					.addComponent(this.jScrollPane1, GroupLayout.PREFERRED_SIZE, 413, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(
							thisLayout
									.createParallelGroup()
									.addGroup(
											GroupLayout.Alignment.LEADING,
											thisLayout.createSequentialGroup().addComponent(this.wrapperPanel, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE)
													.addGap(0, 6, Short.MAX_VALUE))
									.addGroup(
											GroupLayout.Alignment.LEADING,
											thisLayout.createSequentialGroup().addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, GroupLayout.PREFERRED_SIZE)
													.addComponent(this.optionsWrapper, GroupLayout.PREFERRED_SIZE, 195, GroupLayout.PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE))).addGap(6));
			thisLayout.setHorizontalGroup(thisLayout
					.createParallelGroup()
					.addComponent(this.jScrollPane1, GroupLayout.Alignment.LEADING, 0, 1146, Short.MAX_VALUE)
					.addGroup(
							GroupLayout.Alignment.LEADING,
							thisLayout.createSequentialGroup().addPreferredGap(this.jScrollPane1, this.wrapperPanel, LayoutStyle.ComponentPlacement.INDENT)
									.addComponent(this.wrapperPanel, GroupLayout.PREFERRED_SIZE, 819, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
									.addComponent(this.optionsWrapper, GroupLayout.PREFERRED_SIZE, 291, GroupLayout.PREFERRED_SIZE).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

			this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
			this.setTitle(GuiComponentLabels.ARCHER_DB);

			this.pack();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String [] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ArcherDbEditor.getInstance().setLocationRelativeTo(null);
				ArcherDbEditor.getInstance().setVisible(true);
			}
		});
	}

	public JLabel getInformationLabel() {
		if (this.informationLabel == null) {
			this.informationLabel = new JLabel();
		}
		return this.informationLabel;
	}

	public JButton getDeleteEntryButton() {
		return this.deleteEntryButton;
	}

	public void setDeleteEntryButton(JButton deleteEntryButton) {
		this.deleteEntryButton = deleteEntryButton;
	}

	public JButton getAddArcherButton() {
		return this.addArcherButton;
	}

	public void setAddArcherButton(JButton addArcherButton) {
		this.addArcherButton = addArcherButton;
		addArcherButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				ArcherDbEditor.this.controller.addArcher();
			}
		});
	}

	public JButton getSaveButton() {
		return this.saveButton;
	}

	public void setSaveButton(JButton saveButton) {
		this.saveButton = saveButton;
	}

	public JButton getCloseButton() {
		return this.closeButton;
	}

	public void setCloseButton(JButton closeButton) {
		this.closeButton = closeButton;
	}

	public JScrollPane getjScrollPane1() {
		return this.jScrollPane1;
	}

	public void setjScrollPane1(JScrollPane jScrollPane1) {
		this.jScrollPane1 = jScrollPane1;
	}

	public JTable getDbView() {
		return this.dbView;
	}

	public void setDbView(JTable dbView) {
		this.dbView = dbView;
	}

	public JComboBox getCountryDropDown() {
		return this.countryDropDown;
	}

	public void setCountryDropDown(JComboBox countryDropDown) {
		this.countryDropDown = countryDropDown;
	}

	public JComboBox getBowCathegoryDropDown() {
		return this.bowCathegoryDropDown;
	}

	public void setBowCathegoryDropDown(JComboBox bowCathegoryDropDown) {
		this.bowCathegoryDropDown = bowCathegoryDropDown;
	}

	public JComboBox getAgeClassDropDown() {
		return this.ageClassDropDown;
	}

	public void setAgeClassDropDown(JComboBox ageClassDropDown) {
		this.ageClassDropDown = ageClassDropDown;
	}

	public JComboBox getNationDropDown() {
		return this.nationDropDown;
	}

	public void setNationDropDown(JComboBox nationDropDown) {
		this.nationDropDown = nationDropDown;
	}

	public JComboBox getClubDropDown() {
		return this.clubDropDown;
	}

	public void setClubDropDown(JComboBox clubDropDown) {
		this.clubDropDown = clubDropDown;
	}

	public JComboBox getGenderDropDown() {
		return this.genderDropDown;
	}

	public void setGenderDropDown(JComboBox genderDropDown) {
		this.genderDropDown = genderDropDown;
	}

	public JTextField getBirthdateTextBox() {
		return this.birthdateTextBox;
	}

	public void setBirthdateTextField(JTextField birthdateTextField) {
		this.birthdateTextBox = birthdateTextField;
	}

	public JTextField getNameTextBox() {
		return this.nameTextBox;
	}

	public void setNameTextBox(JTextField nameTextBox) {
		this.nameTextBox = nameTextBox;
	}

	public JTextField getSurNameTextBox() {
		return this.surNameTextBox;
	}

	public void setSurNameTextBox(JTextField surNameTextBox) {
		this.surNameTextBox = surNameTextBox;
	}

	public JLabel getAgeLabel() {
		return this.ageLabel;
	}

	public void setAgeLabel(JLabel ageLabel) {
		this.ageLabel = ageLabel;
	}

	public JLabel getBowCathegoryLabel() {
		return this.bowCathegoryLabel;
	}

	public void setBowCathegoryLabel(JLabel bowCathegoryLabel) {
		this.bowCathegoryLabel = bowCathegoryLabel;
	}

	public JLabel getCountryRatingLabel() {
		return this.countryRatingLabel;
	}

	public void setCountryRatingLabel(JLabel countryRatingLabel) {
		this.countryRatingLabel = countryRatingLabel;
	}

	public JLabel getNameLabel() {
		return this.nameLabel;
	}

	public void setNameLabel(JLabel nameLabel) {
		this.nameLabel = nameLabel;
	}

	public JLabel getSurNameLabel() {
		return this.surNameLabel;
	}

	public void setSurNameLabel(JLabel surNameLabel) {
		this.surNameLabel = surNameLabel;
	}

	public JLabel getNationLabel() {
		return this.nationLabel;
	}

	public void setNationLabel(JLabel nationLabel) {
		this.nationLabel = nationLabel;
	}

	public JLabel getClubLabel() {
		return this.clubLabel;
	}

	public void setClubLabel(JLabel clubLabel) {
		this.clubLabel = clubLabel;
	}

	public JLabel getGenderLabel() {
		return this.genderLabel;
	}

	public void setGenderLabel(JLabel genderLabel) {
		this.genderLabel = genderLabel;
	}

	public JLabel getLicenseLabel() {
		return this.licenseLabel;
	}

	public void setLicenseLabel(JLabel licenseLabel) {
		this.licenseLabel = licenseLabel;
	}

	public JLabel getCountryLabel() {
		return this.countryLabel;
	}

	public void setCountryLabel(JLabel countryLabel) {
		this.countryLabel = countryLabel;
	}

	public JLabel getAgeClassLabel() {
		return this.ageClassLabel;
	}

	public void setAgeClassLabel(JLabel ageClassLabel) {
		this.ageClassLabel = ageClassLabel;
	}

	public JLabel getBirthDateLabel() {
		return this.birthDateLabel;
	}

	public void setBirthDateLabel(JLabel birthDateLabel) {
		this.birthDateLabel = birthDateLabel;
	}

	public JLabel getComputedAgeLabel() {
		return this.computedAgeLabel;
	}

	public void setComputedAgeLabel(JLabel computedAgeLabel) {
		this.computedAgeLabel = computedAgeLabel;
	}

	public JPanel getOptionsWrapper() {
		return this.optionsWrapper;
	}

	public void setOptionsWrapper(JPanel optionsWrapper) {
		this.optionsWrapper = optionsWrapper;
	}

	public JPanel getWrapperPanel() {
		return this.wrapperPanel;
	}

	public void setWrapperPanel(JPanel wrapperPanel) {
		this.wrapperPanel = wrapperPanel;
	}

	public JCheckBox getLicenseCheckBox() {
		return this.licenseCheckBox;
	}

	public void setLicenseCheckBox(JCheckBox licenseCheckBox) {
		this.licenseCheckBox = licenseCheckBox;
	}

	public JCheckBox getCountryRatingCheckBox() {
		return this.countryRatingCheckBox;
	}

	public void setCountryRatingCheckBox(JCheckBox countryRatingCheckBox) {
		this.countryRatingCheckBox = countryRatingCheckBox;
	}

	public ArcherDbEditorController getController() {
		return this.controller;
	}

	public void setController(ArcherDbEditorController controller) {
		this.controller = controller;
	}

	public void setInformationLabel(JLabel informationLabel) {
		this.informationLabel = informationLabel;
	}
}
